<template>
<!-- 查询结果 -->
  <el-table :data="searchresult" border style="width: 90%">
    <el-table-column type="index" width="80">
    </el-table-column>
    <el-table-column prop="SALEDETAILNO" label="保险单号" width="250">
    </el-table-column>
    <el-table-column prop="ORGNAME" label="保险销售机构名称" width="200">
    </el-table-column>
    <el-table-column prop="CUSTNAME" label="被保险人姓名" width="150">
    </el-table-column>
    <el-table-column prop="PASSPORTNUMBER" label="护照号码" width="150">
    </el-table-column>
    <el-table-column prop="BIRTHDAY" label="出生日期" width="150" :formatter="localDataFomatter">
    </el-table-column>
    <el-table-column prop="PRODUCTNAME" label="产品类型" width="150">
    </el-table-column>
    <el-table-column prop="CERTDATE" label="保险责任开始时间" width="150"  :formatter="localDataFomatter">
    </el-table-column>
    <el-table-column prop="STATUS" label="状态" width="100">
    </el-table-column>
    <!-- <el-table-column prop="PRODUCTNO" label="套餐编号" width="100">
    </el-table-column> -->
    <el-table-column label="操作" width="100">
      <template scope="scope">
        <el-button type="text" size="media" @click="goform(scope.row.PRODUCTNAME,scope.row.SALEDETAILNO,scope.row.PRODUCTNO)">
          <i class="el-icon-edit"> 报案</i>
        </el-button>
      </template>

    </el-table-column>
  </el-table>
</template>
<script>
export default {
  props: {
    searchresult: {
      type: Array,
      default: []
    }
  },
  methods: {
     localDataFomatter(row, column, cellValue) {
      cellValue = cellValue + "Z";
      var data = new Date(cellValue);
      var dataString =
        data.getFullYear() +
        "/" +
        (data.getMonth() + 1 >= 10
          ? data.getMonth() + 1
          : "0" + (data.getMonth() + 1)) +
        "/" +
        (data.getDate() >= 10 ? data.getDate() : "0" + data.getDate()) ;
        // " " +
        // (data.getHours() >= 10 ? data.getHours() : "0" + data.getHours()) +
        // ":" +
        // (data.getMinutes() >= 10 ? data.getMinutes() : "0" + data.getMinutes());
      return dataString;
    },
    goform(type, SALEDETAILNO,PRODUCTNO) {
      this.$router.push({
        path: 'reportform',
        query: {
          type: type,
          saleno: SALEDETAILNO,
          pno:PRODUCTNO
        }
      });
    }
  }
}
</script>